const { contextBridge, ipcRenderer } = require('electron')

window.addEventListener('DOMContentLoaded', () => {
  let messageText = document.getElementById('result-text');

  // 获取main端消息通知
  ipcRenderer.on('message-reply', (event, data) => {
    messageText.innerHTML = '已选文件: ' + data
  })
})

contextBridge.exposeInMainWorld('openFile', {
  open: (e) => ipcRenderer.invoke('open-mode:open', e),
})